package com.cnzz.site1255174697.fragment.main;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.cnzz.site1255174697.R;
import com.cnzz.site1255174697.base.BaseRecyclerFragment;
import com.cnzz.site1255174697.factory.IndexFactory;
import com.cnzz.site1255174697.holder.BigViewHolder;
import com.cnzz.site1255174697.model.BigEntity;
import com.cnzz.site1255174697.utils.SystemBarUtils;
import com.cqyanyu.yanyu.utils.XToastUtil;
import com.cqyanyu.yanyu.view.FontIconView;

import org.xutils.common.util.LogUtil;

/**
 * 非常大牌
 */
public class BigFragment extends BaseRecyclerFragment implements View.OnClickListener {

    protected FontIconView fiTitle;
    protected FontIconView btn_left;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        initView(inflater, 0);
        loadView();
        SystemBarUtils.setSystemBarColor(getActivity(), rootView);
        bindItemHolder(BigEntity.class, BigViewHolder.class);
        loadData();
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    private void loadView() {
        fiTitle = (FontIconView) rootView.findViewById(R.id.fi_title);
        btn_left = (FontIconView) rootView.findViewById(R.id.btn_left);
        btn_left.setVisibility(View.GONE);
        fiTitle.setText(getString(R.string.big));
        fab.setOnClickListener(this);
    }

    @Override
    public void loadData() {
        super.loadData();
        IndexFactory.getSuperBig(getActivity(), page, this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.fab) {
            mRecyclerView.getRecyclerView().smoothScrollToPosition(0);
        }
    }
}
